<?php
/**
 * 描述：船舶人才。
 * @final
 */
final class Exec_Job_Index extends Exec
{
    public function Get()
    {
        #获取数据-头条
        $data=DB::GetRows('select * from news where M_IsHeadline=TRUE and M_IsDelete=FALSE order by M_IsHeadline_Datetime desc,ID desc limit 0,1');
        if($data)
        {
            $data[0]['Content']=strip_tags($data[0]['Content']);
            $data[0]['Thumbnail']=Config::PATH_RELATIVE_ATTACHMENT_NEWS.'/'.$data[0]['Thumbnail'];
            $data[0]['M_HTMLFile']=Config::PATH_RELATIVE_CONTENT_NEWS.'/'.$data[0]['M_HTMLFile'];
        }
        View::Assign('Job_Index_NewsHeadline',@$data[0]);

        #获取数据-推荐
        $data=DB::GetRows('select * from news where M_IsRecommend=TRUE and M_IsDelete=FALSE order by M_IsRecommend_Datetime desc limit 0,4');
        if($data)
        {
            foreach ($data as &$row)
            {
                $row['ClassName']=DAO_NewsClass::GetNameByID($row['ClassID']);
                $row['M_HTMLFile']=Config::PATH_RELATIVE_CONTENT_NEWS.'/'.$row['M_HTMLFile'];
            }
        }
        View::Assign('Job_Index_NewsRecommend',$data);

        #排行
        View::Assign('Job_Index_NewsRanking',DAO_News::Ranking(8));

        #访谈
        $data=DB::GetRows('select * from interview order by ID desc limit 0,3');
        @$data[0]['ThumbnailPath']=Config::PATH_RELATIVE_ATTACHMENT_TEMP.'/'.@$data[0]['ThumbnailPath'];
        View::Assign('Job_Index_Interview_Topside',@$data[0]);
        View::Assign('Job_Index_Interview',array_slice($data,1,count($data)));
       
        #专题
        $data=DB::GetRows('select * from topic order by ID desc limit 0,1');
        foreach($data as &$row)
        {
            $row['ThumbnailPath']=Config::PATH_RELATIVE_ATTACHMENT_TOPIC.'/'.$row['ThumbnailPath'];
        }
        View::Assign('Job_Index_Topic',$data);

        #观察
        $data=DB::GetRows('select * from news where M_IsDelete=FALSE and SubclassID='.DAO_NewsClass::OBSERVE_COMMENT_ID.' and (Thumbnail is not NULL and Thumbnail<>"") order by M_IsTop desc,M_IsTop_Datetime desc,ID desc limit 0,1');
        foreach($data as &$row)
        {
            $row['Thumbnail']=Config::PATH_RELATIVE_ATTACHMENT_NEWS.'/'.$row['Thumbnail'];
        }
        View::Assign('Job_Index_Observe',$data);

        #展会新闻
        $data=DAO_News::Subclass_Default(DAO_NewsClass::EXHIBITION_NEWS_ID,8);
        View::Assign('Job_Index_ExhibitionNews_ClassID',DAO_NewsClass::EXHIBITION_NEWS_ID);
        View::Assign('Job_Index_ExhibtionNews',$data);

        #参展回顾
        $data=DAO_News::Subclass_Default(DAO_NewsClass::EXHIBITION_REVIEW_ID,8);
        View::Assign('Job_Index_Review_ClassID',DAO_NewsClass::EXHIBITION_REVIEW_ID);
        View::Assign('Job_Index_Review',$data);

        #渲染输出
        View::Display('job/index.tpl');
    }

    public function Post()
    {
    }
}
?>